package com.pn.service.impl;

import com.pn.entity.ProductType;
import com.pn.mapper.ProductTypeMapper;
import com.pn.service.ProductTypeService;
import com.pn.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

@Service
public class ProductTypeServiceImpl implements ProductTypeService {

    @Autowired
    private ProductTypeMapper productTypeMapper;

    //根据分类编码验证商品分类是否存在
    @Override
    public Result checkTypeCode(String typeCode) {
        ProductType productType = new ProductType();
        productType.setTypeCode(typeCode);
        ProductType productType1 = productTypeMapper.findTypeByCodeOrName(productType);

        return Result.ok(productType1 == null);
    }


}
